#pragma once

#include <string>
#include <base/resourcemanager.h>
#include <base/d3d.h>
#include <gui/GuiControl.h>
#include <gui/GuiLabel.h>

#define GUIBUTTON_HOVER 0x01
#define GUIBUTTON_CLICK 0x02
#define GUIBUTTON_NORMAL 0x04

class GuiButton : public GuiControl  {
public:
   // Label with caption, texture filename, sound on click filename, sound on hover filename, x, y, width, height, width of the border (on the texture)
   GuiButton(Device * device, GuiLabel * label, std::string textureFile, std::string clickSoundFile, std::string hoverSoundFile, float x, float y, float width, float height, long borderSize);
   
   // Label with caption, texture resource, sound on click resource, sound on hover resource, x, y, width, height, width of the border (on the texture)
   GuiButton(GuiLabel * label, long textureFile, long clickSoundFile, long hoverSoundFile, float x, float y, float width, float height, long borderSize);
   
   ~GuiButton();

   inline void SetCaption(std::string caption) {_caption->SetText(caption);}

   // inherited
   virtual void Update(long mouseX, long mouseY, unsigned long key, double tElapsed);
   virtual void Draw(Device * device, double tElapsed) const;

private:
   float _texwidth;
   float _texheight;
   float _borderWidth;
   long _image;
   long _clickSound;
   long _hoverSound;

   GuiLabel * _caption;
};